package com.wrial.test;
/*
 * @Author  Wrial
 * @Date Created in 14:04 2020/8/4
 * @Description
 */

import java.util.*;

public class Main {
    public static void main(String[] args) {

    }

    public int findKthLargest(int[] nums, int k) {
        //最大堆
        PriorityQueue<Integer> queue = new PriorityQueue<>(nums.length, (a, b) -> b - a);
        for (int num : nums) {
            queue.add(num);
        }
        for (int i = 1; i < k; i++) {
            queue.poll();
        }
        return queue.peek();
    }
}
